# -*-encoding: utf-8 -*-

from pyramid.view import view_config
from pyramid.view import view_defaults
from pyramid.response import Response

@view_defaults(renderer='../../templates/YxStarter.pt')
class IndexView:
    def __init__(self, request):
        self.request = request

    @view_config(route_name='IndexRoute')
    def IndexRoute(request):
        return {'name': 'Index View'}

    @view_config(route_name='SearchRoute', request_method='GET')
    def SearchRoute(self):
        name = self.request.params['term']
        print name
        #return {'name': name}
        return Response('<body>Go back <a href="/">home</a></br>The input is ' + name + '</body>')
